package com.mtk.launcher.power.util;

import com.lark.wifi.util.MyLog;
import com.mtk.launcher.power.bean.TimeDealEntity;
import com.mtk.launcher.util.SimpleDateUtil;
import com.mtk.launcher.util.shared.SharedPerManager;

public class CheckTimeUtil {
    /***
     * 检查当前是开机时间还是关机时间
     * @return
     */
    public static boolean checkCurrentIsOnOrOffTime() {
        TimeDealEntity timeDealEntity = SharedPerManager.getPowerOnOffTime();
        if (timeDealEntity == null) {
            return true;
        }
        long powerOnTime = timeDealEntity.getOnTimeShow();
        long powerOffTime = timeDealEntity.getOffTimeShow();
        if (powerOnTime < 0) {
            powerOnTime = 0L;
        }
        if (powerOffTime < 0) {
            powerOffTime = 0L;
        }
        long currentTimeLong = SimpleDateUtil.getCurrentTimelONG();
        MyLog.powerOnOff("===上一次关机=" + powerOffTime + " 开机=" + powerOnTime + "/当前时间=" + currentTimeLong);
        if (currentTimeLong > powerOffTime && currentTimeLong < powerOnTime) {
            //关机时间
            return false;
        } else {
            //当前是开机机时间
            return true;
        }
    }

}
